/*
 * ProductFactory.java
 *
 * Created on March 22, 2007, 4:00 PM
 */

package Data;

import java.util.Map;
import java.util.TreeMap;

/**
 *
 * @author Danny Beutler
 */
public class ProductFactory {
    
    protected Map <String, ProductDAO> m = new TreeMap<String, ProductDAO>();
    private static ProductFactory instance = null;
    
    /**
     * Creates a new instance of RevenueSourceFactory and populates it
     *   with the types of RevenueSources and maps them
     *   to their corresponding DAO.
     * 
     * @param 
     */
    private ProductFactory() {
        
        //m.put("googleintex.RentalBO", RentalDAO.getInstance());
        //m.put("googleintex.PrintBO", PrintDAO.getInstance());
        //m.put("googleintex.ConversionBO", ConversionDAO.getInstance());
        m.put("googleintex.PhysicalProductBO", PhysicalProductDAO.getInstance());
        m.put("googleintex.ConceptualProductBO", ConceptualProductDAO.getInstance());
        //m.put("googleintex.SaleBO", SaleDAO.getInstance());
    }
    
    ///////////////////////////////////////////////////////////////
    ///// Singleton
    
    public static synchronized ProductFactory getInstance() {
        if (instance == null) {
            instance = new ProductFactory();
        }
        return instance;
    }
    
    public ProductDAO getDAO(String type){
        return m.get(type);
    }
}
